<template>
  <div class="modifyLogin">
    <!-- <x-header :left-options="{backText: ''}">修改登录密码</x-header> -->
    <top :text="'修改登录密码'"></top>
    <div style="height: 40px;"></div>
    <div class="mT10">
      <div class="modifyLoginDetail fr">
        <div>
          <span class="c3 mT10 fa">原密码</span>
          <input type="text" class="c9 fa fr15 middle inputSty" placeholder="请输入原密码" v-model="oldPassWord">
        </div>
      </div>
      <div class="modifyLoginDetail fr mT10">
        <div>
          <span class="c3 mT10 fa">新密码</span>
          <input type="text" class="c9 fa fr15 middle inputSty" placeholder="请输入新密码" v-model="newPassWord">
        </div>
      </div>
      <div class="modifyLoginDetail fr">
        <div>
          <span class="c3 mT10 fa">确认密码</span>
          <input type="text" class="c9 fa fr15 middle inputSty" placeholder="请输入确认密码" v-model="confimPassWord">
        </div>
      </div>
    </div>
    <div style="padding:15px;margin-top:100px;">
      <div class="exitLogin" @click="confimBtn">确定</div>
    </div>
  </div>
</template>
<script>
  import { XHeader } from 'vux'
  import tips from '../../service/tips.js'
  import http from '../../service/http.js'
  import Top from '../../components/common/top.vue'
  import util from '../../service/util.js'
  export default {
    data() {
      return {
        oldPassWord: "",
        newPassWord: "",
        confimPassWord: "",
      }
    },
    methods: {
      confimBtn() {
        if (!this.oldPassWord) {
          tips.tips("请输入原密码");
          return false;
        }
        if (!this.newPassWord) {
          tips.tips("请输入新密码");
          return false;
        }
        if (!this.confimPassWord) {
          tips.tips("请输入确认密码");
          return false;
        }
        http.post("/user/pwd", {
          oldPwd: util.md5(this.oldPassWord),
          newPwd: util.md5(this.newPassWord),
          confirm: util.md5(this.confimPassWord)
        }).then((res) => {
          if (res.data.status == 200) {
            tips.tips("修改密码成功");
            history.back();
          }
        }).catch((res) => {
          tips.tips(res.msg)
        })
      }
    },
    components: {
      XHeader,
      Top
    }
  }
</script>
<style lang="less" scoped>
  body {
    background: #f6f6f6;
  }

  .c9 {
    color: #999;
  }

  .fa {
    position: absolute;
  }

  .fr {
    position: relative;
  }

  .fr15 {
    right: 15px;
  }

  .t20 {
    top: 20px;
  }

  .t10 {
    top: 10px;
  }

  .mT10 {
    margin-top: 10px;
  }

  .middle {
    vertical-align: middle;
  }

  .mt15 {
    margin-top: 15px;
  }

  .mgL8 {
    margin-left: 8px;
  }

  .mgb15 {
    margin-bottom: 15px;
  }

  .mgT5 {
    margin-top: 5px;
  }

  .copyBtn {
    color: #fff;
    background: linear-gradient(left, #fedd32, #fe9f0a);
    display: inline-block;
    width: 50px;
    text-align: center;
    height: 20px;
    line-height: 20px;
    font-size: 13px;
    top: 12px;
  }

  .modifyLogin .helpLower {
    transition: all 0.5s;
    transform: rotate(180deg);
  }

  .bankMoney {
    border: none;
    outline: none;
    text-align: right;
    display: inline-block;
    height: 45px;
    width: 70%;
    font-size: 15px;
  }

  .modifyLogin .vux-header {
    background: #fff;
  }

  .modifyLogin .vux-header .vux-header-title {
    line-height: 40px;
    text-align: center;
    font-size: 18px;
    font-weight: 400;
    color: #000;
  }

  .modifyLogin .vux-header .vux-header-left .left-arrow:before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid #000;
    border-width: 1px 0 0 1px;
    -webkit-transform: rotate(315deg);
    transform: rotate(315deg);
    top: 8px;
    left: 7px;
  }

  .modifyLogin .modifyLoginDetail {
    border: 1px solid #f6f6f6;
    min-height: 45px;
    /* line-height: 45px; */
    background: #fff;
    padding-left: 15px;
    position: relative;
  }

  .twoToken {
    border-top: 1px solid #f6f6f6;
    margin-top: 10px;
    color: #666;
    font-size: 14px;
    margin-left: -15px;
    padding-left: 15px;
    padding-top: 10px;
  }

  .exitLogin {
    color: #fff;
    height: 45px;
    line-height: 45px;
    text-align: center;
    background: linear-gradient(left, #fedd32, #fe9e09);
    background: -webkit-gradient(linear, left top, right top, from(#fedd32), to(#fe9e09));
    border-radius: 25px;
    font-size: 22px;
  }

  .modifyLogin .inputSty {
    border: none;
    outline: none;
    display: block;
    height: 45px;
    line-height: 45px;
    text-align: right;
    font-size: 14px;
    width: 60%;
  }
</style>